package com.dingding.user.core.passenger.user.service.impl;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import com.dingding.user.core.passenger.user.dao.IPassengerUserInfoDao;
import com.dingding.user.core.passenger.user.service.IPassengerUserInfoService;

/**
 * 
 * @Description:
 * @author CHEHUANBO
 * @date 2016年12月23日
 * @version V2.6.4
 * 
 */
@Component("passengerUserInfoService")
public class PassengerUserInfoServiceImpl implements IPassengerUserInfoService {

	private static final Logger log = Logger.getLogger(PassengerUserInfoServiceImpl.class);

	@Resource(name = "passengerUserInfoDao")
	private IPassengerUserInfoDao passengerUserInfoDao;

	/**
	 * 
	 * @Description: 将用户优惠券数据量加1
	 * @author CHEHUANBO
	 * @version V2.6.4
	 * 
	 */
	@Override
	public void updateUserCouponNumberAddOne(String userId) {

		try {
			passengerUserInfoDao.updateUserCouponNumber(2, userId);
		} catch (RuntimeException e) {
			log.error("将用户优惠券数据量加1出现异常,userId: " + userId, e);
		}

	}

	/**
	 * 
	 * @Description: 将用户优惠券数据量减1
	 * @author CHEHUANBO
	 * @version V2.6.4
	 * 
	 */
	@Override
	public void updateUserCouponNumberReduceOne(String userId) {

		try {
			passengerUserInfoDao.updateUserCouponNumber(1, userId);
		} catch (RuntimeException e) {
			log.error("将用户优惠券数据量减1出现异常,userId: " + userId, e);
		}

	}

}
